﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <el-form ref="formRefSkipOperations" :model="stateSkipOperations.vmModel" label-width="100px">
    <el-row>
      
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Snnumber_FormItem" prop="Entity.Snnumber" label="SN">
            <el-input v-model="stateSkipOperations.vmModel.Entity.Snnumber" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OperationCode_FormItem" prop="Entity.OperationCode" label="工序编码">
            <el-input v-model="stateSkipOperations.vmModel.Entity.OperationCode" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OperationId_FormItem" prop="Entity.OperationId" label="工序ID">
            <el-input v-model="stateSkipOperations.vmModel.Entity.OperationId" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OperationName_FormItem" prop="Entity.OperationName" label="工序名称">
            <el-input v-model="stateSkipOperations.vmModel.Entity.OperationName" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OrderCode_FormItem" prop="Entity.OrderCode" label="工单编号">
            <el-input v-model="stateSkipOperations.vmModel.Entity.OrderCode" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OrderId_FormItem" prop="Entity.OrderId" label="工单ID">
            <el-input v-model="stateSkipOperations.vmModel.Entity.OrderId" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_IsSkip_FormItem" prop="Entity.IsSkip" label="是否跳站" :rules="[{ required: true, message:'是否跳站为必填项',trigger:'blur'}]">
            <el-select v-model="stateSkipOperations.vmModel.Entity.IsSkip" clearable>
                <el-option :key="1" :value=true :label="$t('message._system.common.vm.tips_bool_true')"></el-option>
                <el-option :key="0" :value=false :label="$t('message._system.common.vm.tips_bool_false')"></el-option>
                </el-select>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_AddTime_FormItem" prop="Entity.AddTime" label="添加时间">
            <el-date-picker v-model="stateSkipOperations.vmModel.Entity.AddTime" clearable></el-date-picker>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_EditTime_FormItem" prop="Entity.EditTime" label="编辑时间">
            <el-date-picker v-model="stateSkipOperations.vmModel.Entity.EditTime" clearable></el-date-picker>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_LastOperationCode_FormItem" prop="Entity.LastOperationCode" label="前工序编码">
            <el-input v-model="stateSkipOperations.vmModel.Entity.LastOperationCode" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_LineCode_FormItem" prop="Entity.LineCode" label="产线编码">
            <el-input v-model="stateSkipOperations.vmModel.Entity.LineCode" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_NextNode_FormItem" prop="Entity.NextNode" label="下一个节点">
            <el-input v-model="stateSkipOperations.vmModel.Entity.NextNode" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_NextOperationCode_FormItem" prop="Entity.NextOperationCode" label="后工序编码">
            <el-input v-model="stateSkipOperations.vmModel.Entity.NextOperationCode" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_NextOperationId_FormItem" prop="Entity.NextOperationId" label="后工序ID">
            <el-input v-model="stateSkipOperations.vmModel.Entity.NextOperationId" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ParentOperationCode_FormItem" prop="Entity.ParentOperationCode" label="父工序编码">
            <el-input v-model="stateSkipOperations.vmModel.Entity.ParentOperationCode" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ParentOperationId_FormItem" prop="Entity.ParentOperationId" label="父工序ID">
            <el-input v-model="stateSkipOperations.vmModel.Entity.ParentOperationId" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_RouteName_FormItem" prop="Entity.RouteName" label="工艺路线名称">
            <el-input v-model="stateSkipOperations.vmModel.Entity.RouteName" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_RouteNumber_FormItem" prop="Entity.RouteNumber" label="工艺路线编号">
            <el-input v-model="stateSkipOperations.vmModel.Entity.RouteNumber" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_RouteVersion_FormItem" prop="Entity.RouteVersion" label="工艺路线版本">
            <el-input v-model="stateSkipOperations.vmModel.Entity.RouteVersion" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ScheduleNumber_FormItem" prop="Entity.ScheduleNumber" label="排程编号">
            <el-input v-model="stateSkipOperations.vmModel.Entity.ScheduleNumber" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Sort_FormItem" prop="Entity.Sort" label="排序">
            <el-input v-model="stateSkipOperations.vmModel.Entity.Sort" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_IsValid_FormItem" prop="Entity.IsValid" label="是否有效" :rules="[{ required: true, message:'是否有效为必填项',trigger:'blur'}]">
            <el-select v-model="stateSkipOperations.vmModel.Entity.IsValid" clearable>
                <el-option :key="1" :value=true :label="$t('message._system.common.vm.tips_bool_true')"></el-option>
                <el-option :key="0" :value=false :label="$t('message._system.common.vm.tips_bool_false')"></el-option>
                </el-select>
        </el-form-item>
    </el-col>
    </el-row>

    <div style="text-align:right;">
      <WtmButton @click="onSubmitSkipOperations"  type="primary" :button-text="$t('message._system.common.vm.submit')" style="margin-top:15px;"/>
      <WtmButton @click="onCloseSkipOperations"  type="primary" :button-text="$t('message._system.common.vm.cancel')" style="margin-top:15px;"/>
    </div>
  </el-form>

</el-card>
</div>
</template>


<script setup lang="ts" name="message._system.common.vm.add;false">
import {  ElMessageBox, ElMessage } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { SkipOperationsApi } from '/@/api/record/SkipOperations';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;

// 定义变量内容
const formRefSkipOperations = ref();
const stateSkipOperations = reactive({
    vmModel: {
	  Entity:{
      			Snnumber: null,
			OperationCode: null,
			OperationId: null,
			OperationName: null,
			OrderCode: null,
			OrderId: null,
			IsSkip: null,
			AddTime: null,
			EditTime: null,
			LastOperationCode: null,
			LineCode: null,
			NextNode: null,
			NextOperationCode: null,
			NextOperationId: null,
			ParentOperationCode: null,
			ParentOperationId: null,
			RouteName: null,
			RouteNumber: null,
			RouteVersion: null,
			ScheduleNumber: null,
			Sort: null,
			IsValid: null,

      },
      
	},
    
     
});

// 取消
const onCloseSkipOperations = () => {
    closeDialog();
};

// 提交
const onSubmitSkipOperations = () => {
    formRefSkipOperations.value?.validate((valid: boolean, fields: any) => {
		if (valid) {
            SkipOperationsApi().add(stateSkipOperations.vmModel).then(() => {
                ElMessage.success(ci.proxy.$t('message._system.common.vm.submittip'));
                emit('refresh');
                closeDialog();
            }).catch((error) => {
                other.setFormError(ci, error);
            })
		}
	})
};

// 页面加载时
onMounted(() => {
    
});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

